<?php
class act_user extends action{
	
	public function runFirst(){
		require_once('function/comm/function.comm.php');
	}

	public function runLast(){
		require_once('function/comm/function.view.php');
		exit;
	}
	
	public function testAct() {
		
	}
	
	public function example() {
		
		//param filter
		$arrParams = array(
				'optional' => array (
						'password' => 'string',
						'is_email' => 'boolen'
				),
				'required' => array (
						'email' => 'email',
						'username' => 'string',
						'age' => 'int|1|100',
						'is_delete' => 'boolen'
				)
		);
		Filter::get($arrParams);
		//mysql total
		$result = core::mysql('tezign')->total('feedback', array());
		var_dump($result);exit;
		//mysql delete
		$result = core::mysql('tezign')->delete('feedback', array('and' => 'content=content'));
		var_dump($result);exit;
		//mysql update
		$result = core::mysql('tezign')->update('feedback', array('page_url' => 'http://www.wfl.com'), array('and' => 'content=content'));
		var_dump($result);exit;
		//mysql add
		$arrData = array(
				'channel' => 1,
				'page_url' => 'http://www.baidu.com/',
				'role_id' => 1,
				'status' => 1,
				'content' => 'content',
		);
		$result = core::mysql('tezign')->add('feedback', $arrData);
		var_dump($result);exit;
		//mysql select or
		$arrWhere = array(
			array('and', 'name=wufaliang', 'age=12'),
			array('(or)', 'id= 3', 'id < 10' ),
			array('or', 'id> 1'),
			array('in', 'status', array(1,2,3)),
			array('!like', 'postion', '%cto')
		);
		$arrData = core::mysql('tezign', 'master')->select('user', $arrWhere, array('limit' => '1', 'group' => 'id'), array('id', 'name', 'age'));
		//mysql play myself
		$dbProxy = core::db()->getConnect('tezign');
		$dbProxy->query('select * from tbl_user where id=10');
		//log
		Log::debug('proxy', array('tag1', 'tag2'));
		Log::fetal('proxy', array('tag1', 'tag2'));
		Log::debug('proxy', array('tag1', 'tag2'));
		Log::debug('proxy', array('tag1', 'tag2'));
		Log::warning('proxy', array('tag1', 'tag2'));
		Log::debug('proxy', array('tag1', 'tag2'));
		Log::debug('proxy', array('tag1', 'tag2'));
		Log::error('proxy', array('tag1', 'tag2'));
		Log::debug('proxy', array('tag1', 'tag2'));
		Log::debug('proxy', array('tag1', 'tag2'));
		//db
		$dbProxy = core::db()->getConnect('tezign');
		$dbSlave = core::db()->getConnect('tezign', 'slave');
		$dbMaster = core::db()->getConnect('tezign', 'master');
		//
	}
	
}